<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .table {
      border-collapse: collapse;
      border: solid 1px black;
    }
    td {
      border: solid 1px black;
    }
  </style>
</head>
<body>
  <table class="table">
    <tr>
      <td>1-1</td>
      <td>2-1</td>
      <td>3-1</td>
      <td>4-1</td>
      <td>5-1</td>
    </tr>
    <tr>
      <td>1-1</td>
      <td>2-1</td>
      <td>3-1</td>
      <td>4-1</td>
      <td>5-1</td>
    </tr>
    
    <tr>
      <td>1-1</td>
      <td>2-1</td>
      <td>3-1</td>
      <td>4-1</td>
      <td>5-1</td>
    </tr>
    
    <tr>
      <td>1-1</td>
      <td>2-1</td>
      <td>3-1</td>
      <td>4-1</td>
      <td>5-1</td>
    </tr>
    
    <tr>
      <td>1-1</td>
      <td>2-1</td>
      <td>3-1</td>
      <td>4-1</td>
      <td>5-1</td>
    </tr>
    
  </table>
  <script>
        var tableEl = document.body.firstElementChild
    for (var i = 0; i < tableEl.rows.length; i++)
    {
     var rowEl = tableEl.rows[i]
     var cellEl = rowEl.cells[i]
     cellEl.style.backgroundColor = "red"
    }
  </script>
</body>
</html>